﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace OkTool.Util
{
    public class StreamUtil
    {
        /// <summary>
        /// Stream write all bytes 
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="byts"></param>
        static public void WriteAll(Stream stream, byte[] byts)
        {
            stream.Write(byts, 0, byts.Length);
        }

        /// <summary>
        /// Stream转bytes
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public static byte[] ToBytes(Stream stream)
        {
           return ConvertUtil.ToBytes(stream);
        }

        /// <summary>
        /// 将byte[]转成Stream
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public static Stream ToStream(byte[] bytes)
        {
           return ConvertUtil.ToStream(bytes);
        }
    }
}
